The present invention relates to memory stacks for storing data in either a last-in-first-out (LIFO) or first-in-first-out (FIFO) arrangement.
There are two primary types of stacks used today. In a first type of stack, shown in FIG. 1, a series of registers are used to store the data elements, with the data element in each register being shifted downward into the next register when a new data element is added to the stack. When the last added data element is removed from the stack in a LIFO arrangement, each data element is moved upward into the next register.
In a second form of stack, the data itself is not moved but the addressing of the data is altered to reflect the position of a particular data element in the stack. Such a system is shown in FIG. 2. A counter 12 is incremented or decremented as data items are pushed into or popped off of the stack. The data items themselves are stored in a memory cell array 14 of RAM 16. The counter produces a multi-bit address code which is decoded by address decoding logic 18 and provided to column drivers 20 and row drivers 22, which are in turn coupled to memory cell array 14. The count of the counter represents the address in RAM 16 of the top of the stack. The circuit of FIG. 2 is easily implemented using standard logic, since the decoding gates are built into the RAM parts. However, when constructing an on-chip stack, area must be paid for to provide the decode logic. In addition, logic is required to increment and decrement the counter and the counter itself takes significant area.